<div id="city-work-bar5" style=" height: 100%">

</div>
<script type="text/javascript">
    $(function () {
        var params1=6;
        var params2=30;
        var params3=60;
        var params4=null;
        bar5(params1,params2,params3,params4);
    })
    function bar5(params1,params2,params3,params4){
        $.ajax({
            url: "#springUrl('/city/vehicleTime')",
            data: {batchId: 59},
            type: "POST",
            success: function (text) {
                var d = JSON.parse(text);
                if (d.success && d.data) {
                    var myChart = echarts.init(document.getElementById('city-work-bar5'), 'macarons');
                    var option = {
                        title: {
                            text: '所需车辆总数：' + d.data.data[0] + '辆',
                            show: true
                        },
                        tooltip: {
                            trigger: 'axis',
                            formatter: function (params) {
                                return "第" + params[0].name + "个小时<br/> 作业车辆：" + params[0].value;
                            },
                            axisPointer: {
                                animation: false
                            }
                        },
                        xAxis: {
                            type: 'category',
                            boundaryGap: false,
                            data: d.data.name
                        },
                        yAxis: {
                            type: 'value',
                            boundaryGap: [0, '100%'],
                            splitLine: {
                                show: false
                            }, max: 30
                        },
                        series: [{
                            name: '作业车辆',
                            type: 'line',
                            showSymbol: false,
                            hoverAnimation: false,
                            data: d.data.data
                        }]
                    }
                    myChart.setOption(option);
                }
            },
            error:function (text) {
                var div1="<div type='text' style='padding-top:15%' class=' text-center  '>查询数据异常</div>";
                $("#city-work-bar5").empty();
                $("#city-work-bar5").prepend(div1);
            }
        })
    }
</script>
